$().ready(function(){
	getSessionId();///获取sessionid
})
function getSessionId(){
	$.ajax({
		type:"POST",dataType:"json",data:{"dataFromType":"ajax","act":"session_id"},
			url:($("#newsurl").val())+"e/jat/",
			success:function(r){
				if(r.flag==1){
					window.session_id=r.msg;
					$("#session_id").val(window.session_id);
					initFlashUpload();
					return false;
				}else if(r.msg){
					alert(r.msg);	
				}else{
					alert("系统错误，请与管理员联系");
				}
					
		}});
}
function editActPic(i){
	popUpLoadUrl("图片编辑",'m_edit_pic',{"act":"m_edit_pic","&id":i},function(){
		$('.edi_one_pic').find('.ok_submit').click(function(){
			var t=$('.edi_one_pic').find('.title').val();
			var c=$('.edi_one_pic').find('.content').val();
			if(!t){alert('名称不能为空！');return false;}
			if(t.length>50){alert('名称长度不合法，请填写50个字符以内字符！');return false;}
			///if(!c){alert('不能为空！');return false;}
			if(c.length>200){if(!confirm('描述字符过长，后台将自动截取20个字符，是否继续？')){return false;}}
			$.post(($("#newsurl").val())+'e/jat/',{'act':'edit_one_pic','i':i,'t':t,'c':c},function(r){
					if(r.flag==1){
						$(".pics-list-"+i).html(t);
						popup_close();
						//listActPic();
					}else if(r && r.msg){
						alert(r.msg);
					}else{
						alert('系统错误！');
					}
				},'json');
		});
	});
	//return false;
}
function deleteActPic(i){
	if(confirm('确认删除？')){
		$.post(($("#newsurl").val())+'e/jat/',{'act':'delete_one_pic','i':i},function(r){
					if(r.flag==1){					
						popup_close();
						listActPic();
					}else if(r && r.msg){
						alert(r.msg);
					}else{
						alert('系统错误！');
					}
		},'json')
	}
}
function show_one_pic(id){
	$(".list_act_pic").show().html('加载中...').load(($("#newsurl").val())+"e/module/m_show_one_pic.php?id="+id+"&r="+parseInt(Math.random()*10000),function(){
				
	});
}
function viewPrePic(){
	
}
function viewNextPic(){
	
}